import { GameConfig } from "./GameConfig";

export class RoomMatchConfig {

    public gameType: number;
    public renshu: number;
    public serve: number; //报名费
    public online: number = 0

    private static configList: Array<RoomMatchConfig> = [
    ]

    constructor(gameType: number, serve: number, renshu: number, online:number) {
        this.gameType = gameType;
        this.serve = serve
        this.renshu = renshu
        this.online = online
    }


    public static json2ConfigList(dataList: Array<object>) {
        this.configList = []
        for (let i = 0; i < dataList.length; i++) {
            this.configList[i] = new RoomMatchConfig(dataList[i]["gameType"], dataList[i]["serve"], dataList[i]["renshu"], dataList[i]["online"])
        }
    }

    public static getRoomMatchConfig(gameType: number) {
        for (let i = 0; i < this.configList.length; i++) {
            let config: RoomMatchConfig = this.configList[i]
            if (config.gameType == gameType) {
                return config;
            }
        }
    }


} 